home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_Tix.idb / usr / freeware / lib / tix4.1 / StackWin.tcl.z / StackWin.tcl
Encoding:
Text File  |  1999-01-26  |  1.8 KB  |  81 lines

  1. # StackWin.tcl --
  2. #
  3. #    Similar to NoteBook but uses a Select widget to represent the pages.
  4. #
  5. # Copyright (c) 1996, Expert Interface Technologies
  6. #
  7. # See the file "license.terms" for information on usage and redistribution
  8. # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  9. #
  10.  
  11. tixWidgetClass tixStackWindow {
  12.     -classname TixStackWindow
  13.     -superclass tixVStack
  14.     -method {
  15.     }
  16.     -flag {
  17.     }
  18.     -configspec {
  19.     }
  20. }
  21.  
  22. proc tixStackWindow:ConstructWidget {w} {
  23.     upvar #0 $w data
  24.  
  25.     tixChainMethod $w ConstructWidget
  26.  
  27.     set data(w:tabs) [tixSelect $w.tabs]
  28.  
  29.     # We can't use the packer because it will conflict with the
  30.     # geometry management of the VStack widget.
  31.     #
  32.     tixManageGeometry $data(w:tabs) "tixVStack:ClientGeomProc $w"
  33. }
  34.  
  35. proc tixStackWindow:add {w child args} {
  36.     upvar #0 $w data
  37.  
  38.     set ret [eval tixChainMethod $w add $child $args]
  39.  
  40.     # Find out the -label option
  41.     #
  42.     tixForEach {flag value} $args {
  43.     if {$flag == "-label"} {
  44.         set label $value
  45.     }
  46.     }
  47.  
  48.     $data(w:tabs) add $child -command "$w raise $child" \
  49.     -text $label
  50.  
  51.     return $ret
  52. }
  53.  
  54. proc tixStackWindow:raise {w child} {
  55.     upvar #0 $w data
  56.  
  57.     $data(w:tabs) config -value $child
  58.  
  59.     tixChainMethod $w raise $child
  60. }
  61.  
  62. proc tixStackWindow:Resize {w} {
  63.     upvar #0 $w data
  64.  
  65.     # We have to take care of the size of the tabs so that 
  66.     #
  67.     set tW [winfo reqwidth  $data(w:tabs)]
  68.     set tH [winfo reqheight $data(w:tabs)]
  69.  
  70.     tixMoveResizeWindow $data(w:tabs) $data(-ipadx) $data(-ipady) $tW $tH
  71.     tixMapWindow $data(w:tabs)
  72.  
  73.     set data(pad-y1) [expr $tH + $data(-ipadx)]
  74.     set data(minW)   [expr $tW + 2 * $data(-ipadx)]
  75.     set data(minH)   [expr $tH + 2 * $data(-ipady)]
  76.  
  77.     # Now that we know data(pad-y1), we can chain the call
  78.     #
  79.     tixChainMethod $w Resize
  80. }
  81.